import { ajaxService } from '@/utils/request';
import {
  postPositionData,
  Role,
  modPositionData,
  GetsinglePosition,
  deletePosition,
} from '../../type';

const env = import.meta.env;
let baseURL = env.VITE_STAFF_URL;

/* 岗位管理   */

//  获取岗位信息
export function GetPositioninformation(params: any) {
  return ajaxService({
    url: '/staff/position/getAll',
    method: 'get',
    baseURL,
    params,
  });
}

// 添加岗位
export function postPosition(data: postPositionData) {
  return ajaxService({
    url: 'staff/position/add',
    data,
    method: 'post',
    baseURL,
  });
}

// 修改岗位
export function modPosition(data: modPositionData) {
  return ajaxService({
    url: 'staff/position/mod',
    data,
    method: 'put',
    baseURL,
  });
}

// 获取单个岗位
export function GetsinglePosition(params: GetsinglePosition) {
  return ajaxService({
    url: 'staff/position/get',
    params,
    method: 'get',
    baseURL,
  });
}

// 删除岗位
export function DeletePosition(data: deletePosition) {
  return ajaxService({
    url: 'staff/position/del',
    data,
    method: 'delete',
    baseURL,
  });
}
